<template>
  <div class="privilege">
    <van-nav-bar title="我的优惠券" left-arrow @click-left="back">
      <van-icon name="info-o" slot="right" v-tap="{methods:show}" />
    </van-nav-bar>
    <ul class="navlist">
      <li>
        未使用
        <div class="nav_line active"></div>
      </li>
      <li>
        已使用
        <div class="nav_line"></div>
      </li>
      <li>
        已过期
        <div class="nav_line"></div>
      </li>
    </ul>
    <van-popup v-model="flag" position="bottom">
      <div class="introduce">
        <h1>优惠券使用说明</h1>
        <p>1. 优惠券分为通用券、定向券、满减券、折扣券和运费券。除特殊说明外，通用券可用于全部商品，任意订单可用；定向券只能在购买指定商品时使用；满减券可用于全部商品，但需要订单金额满足条件；折扣券可用于全部商品，任意订单可用，如折扣券设有最高抵用限制，则用券优惠金额以最高抵用金额为上限；运费券可用于抵减订单运费，运费券可与其他券叠加使用；</p>
        <p>2. 通用券、定向券均可分多次使用，直至优惠金额用完</p>
        <p>3. 满减券和折扣券不能与除运费券外的其他优惠券同时使用。一个订单最多只能使用一张满减券或一张折扣券</p>
        <p>4.“免邮”类型的运费券可用于抵用任意档位的运费，新疆、西藏、青海的用户请联系造作客服使用</p>
        <p>5. 系统会自动选择优惠力度最大的优惠券，你也可以选择要使用哪张优惠券</p>
        <p>6. 如发生退货，通用券、定向券会退回相应的金额，满减券和折扣券只有整张订单全部退货后才能退回，运费券不退回</p>
        <p>
          7. 如有任何疑问，欢迎咨询在线客服或致电
          <a href="tel:4006636926">400-6636-926</a>
        </p>
      </div>
    </van-popup>

    <div class="line"></div>
    <div class="content bingo">
      <div class="wrapper">
        <div class="codebox">
          <input type="text" placeholder="请输入优惠券兑换码" />
        </div>
        <div class="coupons-btn">兑换</div>
      </div>
      <div class="img_wrapper" style="display:none">
        <img src="../assets/privilege.png" alt />
      </div>
      <div class="noUse privi">
        <div class="con_main">
          <div class="price">￥180</div>
          <div class="center">
            <p class="desc">180元满减券</p>
            <p class="date">有效期至2019-11-11</p>
          </div>
          <div class="toUse">立即使用</div>
        </div>
        <div class="half"></div>
        <div class="condition">
          <p>满￥4000可用</p>
        </div>
      </div>
      <div class="noUse privi">
        <div class="con_main">
          <div class="price">￥180</div>
          <div class="center">
            <p class="desc">180元满减券</p>
            <p class="date">有效期至2019-11-11</p>
          </div>
          <div class="toUse">立即使用</div>
        </div>
        <div class="half"></div>
        <div class="condition">
          <p>满￥4000可用</p>
        </div>
      </div>
    </div>
    <div class="content">
      <div class="img_wrapper">
        <img src="../assets/privilege.png" alt />
      </div>
    </div>
    <div class="content">
      <div class="img_wrapper" style="display:none">
        <img src="../assets/privilege.png" alt />
      </div>
      <div class="dated privi">
        <div class="con_main">
          <div class="price">￥180</div>
          <div class="center">
            <p class="desc">180元满减券</p>
            <p class="date">有效期至2019-11-11</p>
          </div>
          <div class="toUse">已过期</div>
        </div>
        <div class="half"></div>
        <div class="condition">
          <p>满￥4000可用</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "myprivilege",
  data() {
    return {
      activeName: "a",
      flag: false
    };
  },
  methods: {
    back() {
      this.$router.go(-1);
    },
    show() {
      this.flag = !this.flag;
    }
  },
  mounted() {
    var num = document.getElementsByClassName("navlist")[0].children.length;
    for (let i = 0; i < num; i++) {
      document.getElementsByClassName("navlist")[0].children[
        i
      ].onclick = function() {
        for (var j = 0; j < num; j++) {
          document
            .getElementsByClassName("navlist")[0]
            .children[j].children[0].setAttribute("class", "nav_line");
          document
            .getElementsByClassName("content")
            [j].setAttribute("class", "content");
        }
        this.children[0].setAttribute("class", "nav_line active");
        document
          .getElementsByClassName("content")
          [i].setAttribute("class", "content bingo");
      };
    }
  }
};
</script>

<style scoped>
.van-icon {
  color: #333;
  font-size: 36px;
}
.van-nav-bar__title {
  font-weight: 600;
}
.navlist {
  height: 80px;
  /* overflow: hidden; */
}
.navlist li {
  float: left;
  line-height: 80px;
  font-size: 30px;
  width: 33.3333%;
  text-align: center;
}
.nav_line {
  width: 34px;
  height: 5px;
  background: rgba(0, 0, 0, 1);
  margin: -10px auto;
  display: none;
  transition: 0.3s opacity;
}
.active {
  display: block;
}
.content {
  display: none;
}
.bingo {
  display: block;
}
.line {
  width: 100%;
  height: 12px;
  background: #f6f6f6;
}
.wrapper {
  margin: 26px 34px 9px;
  padding: 17px 34px 17px 23px;
  border: 1px solid #d2d2d2;
  font-size: 0;
  background: #f9f9f9;
}
.codebox {
  display: inline-block;
  vertical-align: top;
  width: auto;
}
.codebox input {
  width: 380px;
  background: #f9f9f9;
  display: block;
  font-size: 24px;
  line-height: 44px;
  border: 0;
}
.wrapper .coupons-btn {
  float: right;
  width: 96px;
  border-radius: 1.5px;
  color: #fff;
  line-height: 44px;
  text-align: center;
  background: #000;
  vertical-align: top;
  font-size: 24px;
  font-weight: 700;
  border: 0;
}
.img_wrapper {
  padding-bottom: 230px;
  padding-top: 200px !important;
  width: 341px;
  height: 341px;
  margin: 0 auto;
}
.img_wrapper img {
  width: 100%;
}
.privi {
  margin: 17px 34px 0;
  border: 1px solid rgba(210, 210, 210, 1);
  padding: 31px 34px 18px 26px;
  box-sizing: border-box;
}
.con_main {
  display: flex;
  justify-content: space-between;
}
.con_main .price {
  min-width: 130px;
  margin-top: 8px;
  font-size: 44px;
  font-weight: 700;
  line-height: 46px;
  text-indent: -3px;
  color: #e56a69;
}
.con_main .center {
  min-width: 250px;
}
.con_main .center .desc {
  font-weight: 700;
  line-height: 24px;
  margin: 0;
  font-size:28px;
}
.con_main .center .date {
  margin-top: 16px;
  font-size: 20px;
  color: rgba(160, 160, 160, 1);
  line-height: 21px;
}
.con_main .toUse {
  width: 96px;
  height: 41px;
  margin-top: 9px;
  background: #000;
  border-radius: 1.5px;
  font-size: 18px;
  font-weight: 700;
  line-height: 41px;
  text-align: center;
  color: #fff;
}
.half {
  width: 100%;
  margin-top: 33px;
  border: 1px dotted #d2d2d2;
}
.condition {
  margin-top: 19px;
  font-size: 20px;
  line-height: 20px;
  color: rgba(160, 160, 160, 1);
}
.dated .price,.dated .desc{
  color: #666;
}
.dated .toUse{
  background: #666;
}
.introduce {
  padding: 30px 33px;
  background: #fff;
  box-sizing: border-box;
}
.introduce h1 {
  font-size: 35px;
  line-height: 1;
  padding-bottom: 30px;
  color: #2b2b2b;
  text-align: left;
  position: relative;
  margin: 0;
}
.introduce h1::after {
  content: "";
  width: 109.5%;
  height: 2px;
  position: absolute;
  left: -33px;
  bottom: 0;
  z-index: 2;
  background: #acacac;
}
.introduce p {
  font-size: 27px;
  line-height: 42px;
  margin-bottom: 0;
}
.introduce p a {
  color: #333;
}
</style>